package com.xxwy.dependency.injection.constructor;

import com.xxwy.dependency.UserHold;
import org.springframework.beans.factory.support.DefaultListableBeanFactory;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;

/**
 * 构造器注入
 * @author wy
 * @date 2020/4/26 15:20
 */
public class XmlDependencyConstructorInjection {
  public static void main(String[] args) {
    DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
    XmlBeanDefinitionReader definitionReader = new XmlBeanDefinitionReader(beanFactory);
    int definitions = definitionReader.loadBeanDefinitions("classpath:/META-INF/dependency-injection-constructor.xml");

    UserHold bean = beanFactory.getBean(UserHold.class);
    System.out.println(bean);
  }
}
